home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-01-14 | 2.5 KB | 73 lines | [TEXT/MPS ] |
- /* _________________________________________________________________________________________________________ //
- Copyright © 1993 Apple Computer, Inc. All rights reserved.
- Macintosh Developer Technical Support.C++ Macintosh Toolbox Framework.
- Programmer: Kent Sandvik
- Date: 1/2/93
- Revision comments are at the end of this file.
- ---
- TMemory is a simple object checks heap and stack values, as well as changes them.
- TMemoryClassTest.cp contains the TMemory class test functions.
- _________________________________________________________________________________________________________ */
-
-
- #ifndef _MEMORYCLASS_
- #include "MemoryClass.h"
- #endif
-
- // CONSTANTS
- const long kMyMinHeap = 200 * 1024;
- const long kMyMinStack = 60 * 1024;
-
- // We will test out various stack and heap sizes. It is recommended to make a separate
- // application (SIOW or something similar) for testing this out. Don't forget to add the
- // special kStackResource -- the test program needs this one.
-
- void main(void)
- {
- cout << "Start of the TMemory object test…\n";
-
- // Create a TMemory object.
- TMemory myMemory(kMyMinHeap, kMyMinStack);
-
- // Check out current sizes.
- cout << "Current Stack size is = " << myMemory.GetStackSize() << '\n';
- cout << "Current Heap size is = " << myMemory.GetHeapSize() << '\n';
-
- // Change stack size.
- cout << "I'm changing the stack size to 60k \n";
- myMemory.SetStackSize(60 * 1024);
- cout << "New Stack size is = " << myMemory.GetStackSize() << '\n';
- cout << "I'm increasing the stack size by 10k \n";
- myMemory.IncreaseStackSize(10 * 1024);
- cout << "New Stack size is = " << myMemory.GetStackSize() << '\n';
- cout << "Current Heap size is = " << myMemory.GetHeapSize() << '\n';
-
- // Check heap size values, valid?
- if (myMemory.CheckHeapSize())
- cout << "OK with the heap size, > 200k\n";
- else
- cout << "Problems with the heap size, < 200k\n";
-
- // Check stack size values, valid?
- if (myMemory.CheckStackSize())
- cout << "OK with the stack size, > 60k\n";
- else
- cout << "Problems with the stack size, < 60k\n";
-
- // Test of resource handling
- if (myMemory.SetStackSizeFromResources())
- cout << "OK with setting the stack size from resources, stack size = " << myMemory.GetStackSize() << '\n';
- else
- cout << "No resources, couldn't set stack size from a resource value\n";
-
- cout << "End of the TMemory object test!\n";
- }
-
- // _________________________________________________________________________________________________________ //
-
- /* Change History (most recent last):
- No Init. Date Comment
- 1 khs 1/2/93 New file
- 2 khs 1/3/93 Cleanup
- */
-